<template>
  <div class="disFlx" style="flex-wrap: wrap;">
    <div v-if="!info.parescriptOrder" class="pr-25 shrink0 py-3">
      <span class="fw-7">服务项目：</span>
      <dict-tag
        v-if="prescriptionInfo"
        style="display: inline-block;"
        :options="dict.type.service_items"
        :value="prescriptionInfo.serviceItems ? String(prescriptionInfo.serviceItems) : '5'"
      />
    </div>
    <div v-else class="pr-25 shrink0 py-3">
      <span class="fw-7">处方类型：</span>
      <dict-tag
        v-if="info.parescriptOrder"
        style="display: inline-block;"
        :options="dict.type.tcm_prescript_type"
        :value="info.parescriptOrder.prescriptionType"
      />
    </div>
    <div v-if="prescriptionInfo && getMaterialsType(prescriptionInfo)" class="pr-25 shrink0 py-3">
      <span class="fw-7">药品类型：</span>
      <span v-if="styleType === 'print'">{{ getMaterialsType(prescriptionInfo) }}</span>
      <el-tag v-else type="warning" effect="plain" size="mini">{{ getMaterialsType(prescriptionInfo) }}</el-tag>
    </div>
    <div v-if="info.parescriptOrder && info.parescriptOrder.dosageformValue" class="pr-25 shrink0 py-3">
      <span class="fw-7">加工剂型：</span>
      <span v-for="dict in dict.type.tcm_dosageform_type">
        <template v-if="dict.value == info.parescriptOrder.dosageformValue">
          <span v-if="styleType === 'print'">{{ dict.label }}</span>
          <el-tag v-else :type="dict.raw.listClass" size="mini">{{ dict.label }}</el-tag>
        </template>
      </span>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    info: {
      type: Object,
      default: () => { }
    },
    prescriptionInfo: {
      type: Object,
      default: () => { }
    },
    styleType: {
      type: String,
      default: ''
    }
  },
  dicts: ["tcm_prescript_type", "service_items", "tcm_dosageform_type"],
  data () {
    return {}
  },
  methods: {
    getMaterialsType(item) {
      const { serviceItems, dictLabel } = item;
      if(serviceItems == 4 && (dictLabel === '中药饮片' || dictLabel === '中药颗粒' || dictLabel === '西药')){
        return dictLabel
      }else if(this.info.parescriptOrder.prescriptionType == 1 && serviceItems == 6){
        return dictLabel
      }else{
        return ''
      }
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
